﻿using System;

namespace rhIRC.Model
{
    public class DataService : IDataService
    {
        public IrcModel CurrentIrcConnector { get; private set; }
        public Server CurrentServer { get; private set; }
        public User CurrentUser { get; private set; }
        public Channel CurrentChannel { get; private set; }

        public void GetData(Action<DataItem, Exception> callback)
        {
            var item = new DataItem("Welcome to MVVM Light");
            callback(item, null);
        }

        public void CreateIrcConnector(Action<IrcModel, Exception> callback, IrcModel ircConnector)
        {
            CurrentIrcConnector = ircConnector;
            callback(CurrentIrcConnector, null);
        }

        public void CreateServer(Action<Server, Exception> callback, Server server)
        {
            CurrentServer = server;
            callback(CurrentServer, null);
        }

        public void CreateUser(Action<User, Exception> callback, User user)
        {
            CurrentUser = user;
            callback(CurrentUser, null);
        }

        public void CreateChannel(Action<Channel, Exception> callback, Channel channel)
        {
            CurrentChannel = channel;
            callback(CurrentChannel, null);
        }
    }
}